package cn.bluech.lib.ui.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter


/**
 * Description:
 * Date: 2020/8/11.
 */
class FmtPageAdapter(fm: FragmentManager, fragments : List<Fragment>)
    : FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
    private lateinit var fmtList : List<Fragment>

    init {
        setFragments(fragments)
    }

    fun setFragments(fragments: List<Fragment>){
        fmtList = fragments
        notifyDataSetChanged()
    }

    override fun getItem(position: Int): Fragment {
        return fmtList[position]
    }

    override fun getCount(): Int {
        return fmtList.size
    }
}